/// <reference path="jquery/jquery.min.js" />
// 通用js
var templateCommon="../../template/common/";
var templateDialog = "../../template/dialog/";
var tmtype ="1";
var systemlayer = 1; //1##FLV 2##TS 3##3GP 4##MP4 5##M3U8  6##ASF/WMP
var movietype = 1; //1#正片 2#预告片
var webPath = "/PPLiveCMSManage/"; 


//数据填充至容器中【需要引用 jquery-jtemplates.js】
function fillDataInContainer(containerId, templateName, parameters, data) {
 $("#" + containerId).setTemplateURL(templateName, null, { filter_data: false });
 if (parameters != "undefined" && parameters != null) {
     for (var i = 0; i < parameters.length; i++) {
         if (typeof (parameters[i].key) != "undefined" && typeof (parameters[i].value) != "undefined") {
             $("#" + containerId).setParam(parameters[i].key, parameters[i].value);
         }
     }
 }
 $("#" + containerId).processTemplate(data);
}

//数据加载中
function dataLoad(containerId){
	$("#" + containerId).load(templateCommon+"loading.htm");
}

/*
//Desc:获取url参数 （如 default.htm?id=2 调用 getUrlparam("id")）
//create time: 2011-5-18
//create by : suzy 
*/
function getUrlParam() {
    var url = window.location.href;
    var u, g, strBack = '';
    if (arguments[arguments.length - 1] == "#")
        u = url.split("#");
    else
        u = url.split("?");
    if (u.length == 1) g = '';
    else g = u[1];
    if (g != '') {
        gg = g.split("&");
        var maxI = gg.length;
        str = arguments[0] + "=";
        for (i = 0; i < maxI; i++) {
            if (gg[i].indexOf(str) == 0) {
                strBack = gg[i].replace(str, "");
                break;
            }
        }
    }
    return strBack;
}


//将字符串拆成字符，并存到数组中
function strToChars(str) {
    var chars = new Array();
    for (var i = 0; i < str.length; i++) {
        chars[i] = [str.substr(i, 1), isCHS(str, i)];
    }
    return chars;
}
//判断某个字符是否是汉字
function isCHS(str, i) {
    if (str.charCodeAt(i) > 255 || str.charCodeAt(i) < 0)
        return true;
    else
        return false;
}
//截取字符串（从start字节到end字节）
function subCHString(strs, start, end, hasDot) {
    var len = 0;
    var str = "";
    var charsArray = strToChars(strs);
    for (var i = 0; i < strs.length; i++) {
        if (charsArray[i][1])
            len += 2;
        else
            len++;
        if (end < len) {
            if (hasDot)
                str += "...";
            return str;
        } else if (start < len)
            str += charsArray[i][0];
    }
    return str;
}
//截取字符串（从start字节到end字节）
function subCHStringLen(strs, start) {
    var len = 0;
    var str = "";
    var charsArray = strToChars(strs);
    for (var i = 0; i < strs.length; i++) {
        if (charsArray[i][1])
            len += 2;
        else
            len++;
    }
    return len;
}
//截取字符串（从start字节截取length个字节）
function subCHStr(str, start, length, hasDot) {
    subCHString(str, start * 2, start * 2 + length * 2, hasDot);
}

//截取字符串（截取length个字节）
function subCHLenStr(str, length, hasDot) {
    return subCHString(str, 0, length * 2, hasDot);
}

//区域截取字符串
function subCHLenStrByAreaId(areaId, className, length, hasDot) {
    $("#" + areaId).find("." + className).each(function () {
        var value = $(this).html();
        $(this).html(subCHLenStr(value, length, hasDot));
    });
}


//字符串格式化
function strformat(str) {
    if (arguments.length == 0)
        return "";
    var strArray = str.split("{");
    for (var i = 1; i < arguments.length; i++) {
        str = str.replace("{" + (i - 1) + "}", "" + arguments[i] + ""); //防止浏览器对整数替换异常
    }
    return str;
}

//判断是否为数字
function isNum(s) {
    if (s != null && s != "") {
        return !isNaN(s);
    }
    return false;
}



/*
//Desc:多选框数组
//create time: 2011-5-18
//create by : suzy 
*/
function initCheckBox(id, areaId) {
    if ($("#" + id).attr("checked"))
        $("#" + areaId + " :checkbox").attr("checked", "checked"); //全选
    else
        $("#" + areaId + " :checkbox").removeAttr("checked"); //全清
}

/*
//Desc:多选框事件绑定
//create time: 2011-5-20
//create by : suzy 
*/
function initCheckboxEvent(id, areaId) {
    $("#" + id).removeAttr("checked");
    $("#" + id).click(function () {
        initCheckBox(id, areaId);
    });
}

/*
//Desc:清理全选框
//create time: 2011-5-25
//create by : suzy 
*/
function clearCheckbox(id) {
    if ($("#" + id).attr("checked") == "checked")
        $("#" + id).removeAttr("checked");
}

/*
//Desc:获取复选框所有值
//create time: 2011-5-18
//create by : suzy 
*/
function getCheckboxValue(areaId, tipsMessage) {
    var str = "";
    if (typeof (tipsMessage) == "undefined")
        tipsMessage = message.mustSelectedRecord();
    $("#" + areaId + " :checkbox").each(function () {
        if ($(this).attr("checked")) {
            if (str != "")
                str += "," + $(this).val();
            else
                str = $(this).val();
        }
    });
    if ($.trim(str) == "" && str.length <= 0) {
        if (tipsMessage != null && tipsMessage.length > 0)
            alert(tipsMessage);
    }
    return str;
}

/*
//Desc:获取复选框单个值
//create time: 2011-5-20
//create by : suzy 
*/
function getCheckboxOneValue(areaId) {
    var str = getCheckboxValue(areaId);
    var strArray = str.split(",");
    var length = strArray.length;
    var reStr = "";
    if (length > 1)
        alert(message.mustSelectedOnlyOneRecord());
    else
        reStr = strArray[strArray.length - 1];
    return reStr;
}


/*
//Desc:重置数据
//create time: 2011-5-21
//create by : suzy 
*/
function resetData(areaId) {
    $("#" + areaId).find("input[type!='button']").val(""); //清空输入框
    $("#" + areaId).find("select").find("option:first").attr("selected", "selected"); //清空下拉框
    $("#" + areaId + " :checkbox").removeAttr("checked"); //清空选择框
    $("#" + areaId + " textarea").text(""); //清空所有区域框
}

/*
//Desc:搜索过滤
//create time: 2011-10-13
//create by : suzy 
*/
function searchFilter(areaId){
	if($("#"+areaId).is(":hidden")){
		resetData(areaId);
	}
}

/*
//Desc:搜索条件
//create time: 2011-5-24
//create by : suzy 
*/
function searchCondition(areaId) {
    var reStr = "";
    $("#" + areaId).find("input[type!='button']").each(function () {
        if ($.trim($(this).val()).length > 0)
            reStr += getSearchValueStr($(this).attr("name"), $(this).val());
    });

    $("#" + areaId).find("select").each(function () {
        if ($.trim($(this).val()).length > 0 && $.trim($(this).val()) != "-1")
            reStr += getSearchValueStr($(this).attr("name"), $(this).find("option:selected").text());
    });

    return reStr;
}

/*
//Desc:比较json
//create time: 2011-5-24
//create by : suzy 
*/
function compareJson(json1, json2) {
    if (JSON.stringify(json1) == JSON.stringify(json2))
        return true;
    return false;
}

/*
//Desc:比较日期时间
//create time: 2011-5-24
//create by : suzy 
*/
function compareLessThanDateTimeStr(str1, str2) {
    //转换日期
    var str1 = str1.replace(/-/g, "/");
    var str2 = str2.replace(/-/g, "/");
    var date1 = new Date(Date.parse(str1));
    var date2 = new Date(Date.parse(str2));

    //小于则返回true
    if (date1 < date2)
        return true;
    return false;
}


/**     
* 对Date的扩展，将 Date 转化为指定格式的String     
* 月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) 可以用 1-2 个占位符     
* 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)     
* eg:     
* (new Date()).pattern("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423     
* (new Date()).pattern("yyyy-MM-dd E HH:mm:ss") ==> 2009-03-10 二 20:09:04     
* (new Date()).pattern("yyyy-MM-dd EE hh:mm:ss") ==> 2009-03-10 周二 08:09:04     
* (new Date()).pattern("yyyy-MM-dd EEE hh:mm:ss") ==> 2009-03-10 星期二 08:09:04     
* (new Date()).pattern("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18     
*/     
Date.prototype.pattern=function(fmt) {        
        var o = {        
        "M+" : this.getMonth()+1, //月份        
        "d+" : this.getDate(), //日        
        "h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时        
        "H+" : this.getHours(), //小时        
        "m+" : this.getMinutes(), //分        
        "s+" : this.getSeconds(), //秒        
        "q+" : Math.floor((this.getMonth()+3)/3), //季度        
        "S" : this.getMilliseconds() //毫秒        
        };        
        var week = {        
        "0" : "\u65e5",        
        "1" : "\u4e00",        
        "2" : "\u4e8c",        
        "3" : "\u4e09",        
        "4" : "\u56db",        
        "5" : "\u4e94",        
        "6" : "\u516d"     
        };        
        if(/(y+)/.test(fmt)){        
                fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));        
        }        
        if(/(E+)/.test(fmt)){        
                fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[this.getDay()+""]);        
        }        
        for(var k in o){        
                if(new RegExp("("+ k +")").test(fmt)){        
                        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));        
                }        
        }        
        return fmt;        
}

//获取当前时间字符串
function getNowString(){
	var nowDate = new Date();
	return nowDate.pattern("yyyyMMdd_hhmmss_S");
}

/*
//Desc:改变图片尺寸
//create time: 2011-6-27
//create by : suzy 
*/
function changeImage(obj,callback) {
    var maxWidth = 530;
    var maxHeight = 330;
    var initWidth = obj.width;
    var initHeight = obj.height;
    var width = initWidth;
    var height = initHeight;  

    if (width > maxWidth) {
        width = maxWidth;
        height = (maxWidth * initHeight) / initWidth;
        if (height > maxHeight) {
            height = maxHeight;
            width = (maxHeight * initWidth) / initHeight;
        }
    } else if (height > maxHeight) {
        height = maxHeight;
        width = (maxHeight * initWidth) / initHeight;
        if (width > maxWidth) {
            width = maxWidth;
            height = (maxWidth * initHeight) / initWidth;
        }
    }
    //图片赋值
    obj.width = width;
    obj.height = height;
    if (typeof (callback)!="undefined")
      callback(); //执行回调函数
} 


/*
//Desc:整数输入控制 
//create time: 2011-6-27
//create by : suzy 
*/
function IntInput(e, obj, count) {
    var key = e.keyCode;
    var len = obj.value.length;
    //有效输入：数字0到9
    if (key >= 48 && key <= 57 && len < count) {
    } else {
        e.keyCode = 0;
        e.returnValue = false;
        return false;
    }
}


/*
//Desc:显示消息
 //create time: 2011-8-18
 //create by : suzy 
 //zindex 1000 第一层，2000 第二层，3000 第三层 依此类推
 //closeCallback 自定义关闭回调，如果使用系统，不用赋此参数 
*/
function showDialog(containerId,width,title,zindex,closeCallback) {
	//width = 466;
	  //如果页面元素不存在则返回
	  if($("#"+containerId).length<1)
		  return;
	  //默认值为1000
      if (typeof(zindex)=='undefined')
          zindex = 1000;
      //如果用户自定义关闭方法则执行用户的。
      if(typeof(closeCallback)=='function'){
    	  $("#" + containerId).dialog({
              title: title,
              width: width,
              modal: true,
              zIndex: zindex,
              close: function () {
        	     closeCallback();
              }
          });
      }else{
    	  $("#" + containerId).dialog({
              title: title,
              width: width,
              modal: true,
              zIndex: zindex
          });
      }
}

/*
//Desc:隐藏消息
//create time: 2011-5-18
//create by : suzy 
*/
function hideDialog(containerId) {
 //如果页面元素不存在则返回
  if($("#"+containerId).length<1)
	  return;
  $("#" + containerId).dialog('close');
}


//文本域自适应高度
(function($) {
    $.fn.autoTextarea = function(options) {
        var defaults = {
            maxHeight:null,//文本框是否自动撑高，默认：null，不自动撑高；如果自动撑高必须输入数值，该值作为文本框自动撑高的最大高度
            minHeight:$(this).height() //默认最小高度，也就是文本框最初的高度，当内容高度小于这个高度的时候，文本以这个高度显示
        };
        var opts = $.extend({}, defaults, options);
        return $(this).each(function() {
            $(this).bind("paste cut keydown keyup focus blur", function() {
                var height,style = this.style;
                this.style.height = opts.minHeight + 'px';
                if (this.scrollHeight > opts.minHeight) {
                    if (opts.maxHeight && this.scrollHeight > opts.maxHeight) {
                        height = opts.maxHeight;
                        style.overflowY = 'scroll';
                    } else {
                        height = this.scrollHeight;
                        style.overflowY = 'hidden';
                    }
                    style.height = height + 'px';
                }
            });
        });
    };
})(jQuery);


//自适应高度
function autoIframeHeight(obj){
		if(obj.contentDocument){
			obj.height = obj.contentDocument.body.offsetHeight + 20;
		} else {
			obj.height = obj.contentWindow.document.body.scrollHeight+20;
		}
}

var timeOutAutoContentIframe=null;
function timeOutAutoContentIframeHeight(){
	if(timeOutAutoContentIframe!=null){
		clearTimeout(timeOutAutoContentIframe);
	}
	timeOutAutoContentIframe=setTimeout(autoContentIframeHeight,1500); //延时1.5S适应高度
}

//内容框架自适应高度
function autoContentIframeHeight(){
        var obj = document.getElementById("contentFrame");
		if(obj.contentDocument){
			obj.height = obj.contentDocument.body.offsetHeight + 50;
		} else {
			obj.height = obj.contentWindow.document.body.scrollHeight+50;
		}
}

//菜单栏自适应高度
function autoMenuIframeHeight(){
        var obj = document.getElementById("subFrame");
		if(obj.contentDocument){
			obj.height = obj.contentDocument.body.offsetHeight + 100;
		} else {
			obj.height = obj.contentWindow.document.body.scrollHeight+100;
		}
}

//改变内容地址
var breadValue=null;
function changeContenFrame(url,leftUrl){
	 oldLeftClass = "frame-content frame-col-m";
	 $("#contentFrame").attr("src",url);
	 if(typeof(leftUrl)!="undefined" && leftUrl.length>1){
		 $("#frameCtrl").show();
		 if(url.indexOf("welcome")>-1)
			 document.getElementById("contentDiv").className="frame-content frame-col-s260-m";
		 else
		    document.getElementById("contentDiv").className="frame-content frame-col-s180-m";
		 $("#subFrame").attr("src",leftUrl);
	 }else{
		 document.getElementById("contentDiv").className="frame-content frame-col-m";
		 $("#frameCtrl").hide();
	 }
	 showDialogLoading();
}

//改变内容地址
function changeContenIframe(url){
	$("#contentFrame").attr("src",url);
}

//改变内容地址
var navStr ="";
function changeContenIframeByTree(url,nav,parameter){
	var navString = '';
	var parameters = parameter.split(";");
	var navStrs = "";
	var paras = "";
	var idNames = "";
	var indexlen = parameters.length-1;
	for(var index in parameters){
		var para = parameters[index];
		if(para.length>1){
			paras +=para;
			idNames = para.split(",");
			if(index == indexlen){
				navStrs +="<span>"+idNames[1]+"</span>";
			}else{
				navString = '<a href="javascript:;" onclick="parent.changeContenIframeByTree(\"'+nav+idNames[0]+'\",\"'+nav+'\",\"'+paras+'\")">'+idNames[1]+'</a>&gt;';
				navStrs +=navString;
			}
		}
	}
	navStr = navStrs;
	$("#contentFrame").attr("src",url);
}

//获取导航字符串
function getNavStr(){
	return navStr;
}

//写入导航
function setNavStr(){
	$("#bread").html(parent.getNavStr());
}

//改变导航样式
function changeNavClass(obj){
    $("#navUl .select").removeClass("select");
    if(typeof(obj)!="undefined")
       $(obj).parent().addClass("select");
}

//清理导航选择
function clearNavSelect(){
	$("#topFrame").get(0).contentWindow.changeNavClass();
}

var fr = $(parent.document).find("#contentFrame");
//显示搜索区域
function showSearchArea(){
  $("#searchArea").show();
  $("#showSearchArea").hide();
  $("#hideSearchArea").show();
  fr.height((fr.height()+$("#searchArea").height())+"px");
    fr.height((fr.height()+$("#searchArea").height())+"px");
}

//隐藏搜索区域
function hideSearchArea(){
  $("#showSearchArea").show();
  $("#hideSearchArea").hide();
	$("#searchArea").hide();
	fr.height((fr.height()-$("#searchArea").height())+"px");
}

//显示隐藏左边
var oldLeftClass = null;
function hideShowLeft(){
	var contentDiv = document.getElementById("contentDiv");
	var className = contentDiv.className;
	if(oldLeftClass==null){
		oldLeftClass = className;
		contentDiv.className="frame-content frame-col-m";
	}else{
		contentDiv.className=oldLeftClass;
		oldLeftClass = className;
	}
	if(className.indexOf("frame-col-m")>-1){
		document.getElementById("frameCtrl").className="frame-ctrl  frame-ctrl-closed";
	}else{
		document.getElementById("frameCtrl").className="frame-ctrl frame-ctrl-opened";
	}
}

//跳转页面
function redirectPage(url){
	document.location.href=url; 
}


//显示loading弹出框
function showDialogLoading(){
   var containerId = "dialogLoading";
   showDialog(containerId,600,"",1000);
}

//隐藏loading弹出框
function hideDialogLoading(){
   hideDialog("dialogLoading");
}

//显示提示信息弹出框
function showDialogAlert(content){
   var containerId = "dialogAlert";
   $("#dialogAlertContent").html(content);
   showDialog(containerId,450,"",1000);
}


//显示提示信息确认框
function showDialogConfirm(content,callBackStr){
   var containerId = "dialogConfirm";
   $("#dialogConfirmContent").html(content);
   $("#dialogConfirmDefine").unbind("click").removeAttr("onclick").click(function(){	   
	   hideDialog("dialogConfirm");
	   eval("contentFrame.window."+callBackStr);
   });
   showDialog(containerId,450,"",1000);
}

//AJAX提示框 
function showDialogConfirmAjax(content,url,backfun,datastr){
   var containerId = "dialogConfirm";
   $("#dialogConfirmContent").html(content);
   $("#dialogConfirmDefine").unbind("click").removeAttr("onclick").click(function(){
	   hideDialog("dialogConfirm");
	   ajaxfun(url,backfun,datastr);
   });
   showDialog(containerId,450,"",1000);
}


function ajaxfun(url,backfun,datastr){
	$.ajax({
	url:webPath+url,  //后台处理程序
	//type:'post',    //数据发送方式
	//dataType:'json',  //接受数据格式
	cache:false,
	data:datastr,  //要传递的数据
	error:function(request){
	    requestError(request);
	},
	success:function(result){//回传函数(这里是函数名)
	        requestResult(result,backfun);
	    }
	});
}



//显示返回信息确认框
function showDialogBackConfirm(content,callBackStr,backCallBackStr){
   var containerId = "dialogBackConfirm";
   $("#dialogBackConfirmContent").html(content);
   $("#dialogBackConfirmDefine").unbind("click").removeAttr("onclick").click(function(){	   
	   hideDialog(containerId);
	   eval("contentFrame.window."+callBackStr);
   });
   $("#dialogBackConfirmCancel").unbind("click").removeAttr("onclick").click(function(){	
	   hideDialog(containerId);
	   eval("contentFrame.window."+backCallBackStr);
   });
   showDialog(containerId,450,"",1000);
}

function showDialogIframeConfirm(content,callBackStr){
	   var containerId = "dialogConfirm";
	   $("#dialogConfirmContent").html(content);
	   $("#dialogConfirmDefine").unbind("click").removeAttr("onclick").click(function(){	   
		   hideDialog("dialogConfirm");
		   eval("dialogIframe.window."+callBackStr);
	   });
	   showDialog(containerId,600,"",1000);
}


//显示iframe提示框
function showDialogIframe(url,width,title,height){
    if(typeof(width)=="undefined")
      width = 600;
    if(typeof(title)=="undefined")
      title = '';
    if(typeof(height)=="undefined")
    	height = 400;
	var containerId="dialogIframes";
	 $("#dialogIframe").attr("src",url);
	 $("#containerId").attr("width",width);
	 $("#dialogIframe").attr("height",height);
	 showDialog(containerId,width,title,1000);
}

//显示iframe提示框
function showDialogIframe1(url,width,title,height){
    if(typeof(width)=="undefined")
      width = 600;
    if(typeof(title)=="undefined")
      title = '';
    if(typeof(height)=="undefined")
    	height = 400;
	var containerId="dialogIframes1";
	 $("#dialogIframe1").attr("src",url);
	 $("#dialogIframe1").attr("width",width);
	 $("#dialogIframe1").attr("height",height);
	 showDialog(containerId,width,title,1000);
}

//显示视频提示框
function showDialogVideo(playUrl,title){
	//playUrl = "rtsp://192.168.2.84/files/stb/test.ts";  //测试地址，正常使用请注释此句
    var  width = 520;
    if(typeof(title)=="undefined")
      title = '';
	var containerId="dialogVideo";
	var src = webPath+"/plug/vlcMediaPlay/player.htm?playUrl="+playUrl;
	$("#dialogVideoIframe").attr("src",src);
	showDialog(containerId,width,title,3000,closeDialogVideo);
}

//显示成功提示框
var setTimeDialogSuccessShow = null;
var setTimeDialogSuccessHide = null;
function autoShowDialogSuccess(msg){
	var containerId="dialogSuccess";
	if(setTimeDialogSuccessShow!=null){
		clearTimeout(setTimeDialogSuccessShow);
		setTimeDialogSuccessShow = null;
	}
	setTimeDialogSuccessShow=setTimeout("showDialogSuccess('"+msg+"')",1000);
	if(setTimeDialogSuccessHide!=null){
		clearTimeout(setTimeDialogSuccessHide);
		setTimeDialogSuccessHide = null;
	}
	setTimeDialogSuccessHide=setTimeout("hideDialog('"+containerId+"')",3000);
}

//显示成功
function showDialogSuccess(msg){
	var containerId="dialogSuccess";
	$("#dialogSuccessContent").html(msg);
	showDialog(containerId,400,"",5000);
}

//显示失败提示框
var setTimeDialogFailureShow = null;
var setTimeDialogFailureHide = null;
function autoShowDialogFailure(msg){
	var containerId="dialogFailure";
	if(setTimeDialogFailureShow!=null){
		clearTimeout(setTimeDialogFailureShow);
		setTimeDialogFailureShow = null;
	}
	setTimeDialogFailureShow=setTimeout("showDialogFailure('"+msg+"')",1000);
	if(setTimeDialogFailureHide!=null){
		clearTimeout(setTimeDialogFailureHide);
		setTimeDialogFailureHide = null;
	}
	setTimeDialogFailureHide=setTimeout("hideDialog('"+containerId+"')",3000);
}

//显示成功
function showDialogFailure(msg){
	var containerId="dialogFailure";
	$("#dialogFailureContent").html(msg);
	showDialog(containerId,400,"",5000);
}

//关闭视频提示框
function closeDialogVideo(){
	dialogVideoIframe.window.doStop(); //关闭视频
}

//赋值给子页面
function setSonValue(value,type)
{
	hideDialog("dialogContent");
	contentFrame.window.setValue(value,type);
}

//赋值给服务内容页面
function addProgram(value)
{
	hideDialog("dialogIframes");
	contentFrame.window.addProgram(value);
}

function delcontent(value)
{
	hideDialog("dialogIframes");
	contentFrame.window.delcontent(value);
	
}

//赋值给影片添加详细页面
function submitContents(value){
	hideDialog("dialogIframes");
	contentFrame.window.submitContents(value);
}

//赋值给连续剧添加详细页面
function submitchildContents(value){
    hideDialog("dialogIframes1");
	dialogIframe.window.submitContentschild(value);
}
//删除产品服务
function delService(value)
{
	hideDialog("dialogIframes");
	contentFrame.window.delService(value);
}

//添加服务到产品
function addService(value)
{
	hideDialog("dialogIframes");
	contentFrame.window.addService(value);
}
//添加优惠策略
function addDiscount(value){
	hideDialog("dialogIframes");
	contentFrame.window.addDiscount(value);
}
//删除优惠策略
function delDiscount(value){
	hideDialog("dialogIframes");
	contentFrame.window.delDiscount(value);
}


//
function closeIframeRefreshConetnt(){
	 $("#dialogIframe").attr("src","");
	 hideDialog("dialogIframes");	
	 //contentFrame.location.reload();
	 //contentFrame.click();
}

//成功隐藏iframe谈出框
function successHideIframeDialog(){
    if($(".flash_success").length>0){
    	parent.hideDialog("dialogIframes");
    }
 }

//提交结果绑定
function actionResultBind(){
 //setTimeout(function(){$(".flash_success").slideUp("slow");},2000);
 // setTimeout(function(){$(".flash_error").slideUp("slow");},2000);
}

//请求错误
function requestError(request){
	//cookieCls.setCookie("errorMessage",request.responseText);
	//document.location.href="../../page/error/error.htm"; 
	alert(request.responseText);
}

//请求结果
function requestResult(result,callBack){
    if(typeof(callBack)=="function")
	  callBack(result);
}

//键盘输入控制
function ControlInput(e, obj) {
    var key = e.keyCode;
    var len = obj.value.length;
    //禁用Backspace键
    if (key==8) {
        e.keyCode = 0;
        e.returnValue = false;
        return false;
    }
}

function IntInput2(e, obj) {
    var key = e.keyCode;
    var len = obj.value.length;
    //有效输入：数字0到9
    if (key >= 48 && key <= 57||key==8) {
    } else {
        e.keyCode = 0;
        e.returnValue = false;
        return false;
    }
}

//键盘输入控制
function ControlInput2(e, obj) {
    var key = e.keyCode;
    var len = obj.value.length;
    //有效输入：数字0到9
    if (key >= 48 && key <= 57||key==8) {
    } 
    //输入：-和.
    else if(key==189||key==190){
    	
    }else{
        e.keyCode = 0;
        e.returnValue = false;
        return false;
    }
}
